﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Quanlynhasach.hethongxuly;
using Quanlynhasach.hethongluutru;
using System.IO;
using Quanlynhasach;
using System.Diagnostics;

namespace Quanlynhasach
{
    public partial class frm_TraCuu : Form
    {
        public frm_TraCuu()
        {
            InitializeComponent();
        }

        private void btnTraCuu_Click(object sender, EventArgs e)
        {
            string tenSach = txtSachCanTim.Text;
            dgvSachTraCuu.DataSource = SachDAO.TraCuuSach(tenSach);

             String tl, tg;
            int n = dgvSachTraCuu.RowCount;
            for (int i = 0; i < n-1; i++)
            {
                tg = dgvSachTraCuu.Rows[i].Cells[2].Value.ToString();
                String tentg = TacGiaDAO.LayTenTacGia(tg);
                dgvSachTraCuu.Rows[i].Cells[2].Value = tentg;

                tl = dgvSachTraCuu.Rows[i].Cells[1].Value.ToString();
                String tentl = TheLoaiDAO.LayTenTheLoai(tl);
                dgvSachTraCuu.Rows[i].Cells[1].Value = tentl;
            }
            
        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            this.Close();
        }

      

    }
}
